package com.gt.quality.system.controller;


import com.gt.quality.base.BaseCommonController;
import com.gt.quality.base.BaseCommonService;
import com.gt.quality.system.entity.SysRoleDept;
import com.gt.quality.base.pojo.LayerListViewObject;
import com.gt.quality.base.pojo.Resp;
import com.gt.quality.system.service.SysRoleDeptService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 角色和部门关联表(SysRoleDept)表控制层
 *
 * @author makejava
 * @since 2026-11-25 16:30:08
 */
@RestController
@RequestMapping("sysRoleDept")
@Tag(name = "角色关联部门")
public class SysRoleDeptController extends BaseCommonController<SysRoleDept> {


    /**
     * 服务对象
     */
    @Autowired
    public void setSysRoleDeptService(SysRoleDeptService sysRoleDeptService) {
        this.sysRoleDeptService = sysRoleDeptService;
    }

    private SysRoleDeptService sysRoleDeptService;

    /**
     * 分页查询数据
     *
     * @return 所有数据
     */
    @PostMapping("/queryTree")
    @Operation(summary = "部门树查询角色")
    public Resp<LayerListViewObject> queryPage(@RequestParam("roleId") Long roleId) {
        LayerListViewObject data = sysRoleDeptService.buildTreeDeptInfo(roleId);
        return Resp.ok(data);
    }

    @Override
    public BaseCommonService<SysRoleDept> getThisService() {
        return sysRoleDeptService;
    }

    @Override
    protected boolean isSuperExcel() {
        return false;
    }
}
